home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Tool Chest / Developer Utilities / Installer 4.0.3 SDK / Script Examples / File Compare Vers & Date / MySimpleCompare.r < prev    next >
Encoding:
Text File  |  1994-11-15  |  5.6 KB  |  225 lines  |  [TEXT/MPS ]

  1. //
  2. //    MySimpleCompare.r
  3. //
  4. //    All files from this example are installed to folder "Simple Compare Example"
  5. //    on the root of the selected target volume of the installation.
  6. //
  7. //    This script demonstrates installing two test files, one based on creation 
  8. //    date comparison, the other based on version comparison against target file. 
  9. //    Date for source file, to be compared against target file, is specified in 
  10. //    the source file spec ('infs' ). The version number for source file, to be 
  11. //    compared against target file, is specified in the file atom ( 'infa' ).
  12. //
  13. //    To compare files by date specify 'useSrcCrDateToCompare' within file atom 
  14. //    ( 'infa' ), and to compare files by version specify 'useVersProcToCompare'.
  15. //
  16. //    See the "File Compare by Procedure" example for instructions on how
  17. //    to implement custom version comparison with the Installer.
  18. //
  19. //    NOTE: File versions and dates are ignored during Custom Remove.
  20. //
  21. //
  22. //    mark young • 08/18/94
  23. //
  24. //    Copyright 1993-1994, Apple Computer, Inc., All Rights Reserved
  25. //
  26.  
  27. #include "InstallerTypes.r"
  28.  
  29. // • packages
  30.  
  31. // do a compare before installing based on the Creation date of 
  32. // target file against the date specified in the 'infs' resource
  33. resource 'inpk' (100) {
  34.     format0 {
  35.         showsOnCustom,
  36.         removable,
  37.         dontForceRestart,
  38.         0,
  39.         0,
  40.         "TeachText to “Simple Compare Example” folder ( by creation date )",
  41.         {    
  42.             'infa', 1000
  43.         },
  44.     }
  45. };
  46.  
  47. // do a compare before installing based on the 'vers' (1) resource
  48. // of target against 'vers' value specified in 'infs' resource
  49. resource 'inpk' (200) {
  50.     format0 {
  51.         showsOnCustom,
  52.         removable,
  53.         dontForceRestart,
  54.         0,
  55.         0,
  56.         "TeachText to “Simple Compare Example” folder ( by version )",
  57.         {    
  58.             'infa', 2000
  59.         },
  60.     }
  61. };
  62.  
  63.  
  64. // • file atoms
  65.  
  66. // creation date compare file atom ( date set in 'infs' )
  67. resource 'infa' (1000) {
  68.     format1 {
  69.         deleteWhenRemoving,
  70.         deleteWhenInstalling,
  71.         copy,                            
  72.         dontIgnoreLockedFile,
  73.         dontSetFileLocked,
  74.         useSrcCrDateToCompare,    //  • Use creation date for compare
  75.         srcNeedExist,
  76.         rsrcForkInRsrcFork,
  77.         
  78.         leaveAloneIfNewer,        //  if target file is newer:
  79.                                 //  Easy Install - skip installing file
  80.                                 //    Custom Install - ask "newer,older,cancel"
  81.         
  82.         updateExisting,            //  Update an existing file
  83.         copyIfNewOrUpdate,
  84.         rsrcFork,
  85.         dataFork,
  86.         0,                    // TARGET - size ( filled in by ScriptCheck )
  87.         0x0,                // Finder Attribute flags ( filled in by ScriptCheck )
  88.         10000,                // TARGET - file spec ( 'intf' )
  89.         {    
  90.             10000,            // SOURCE - file spec ( 'infs' )
  91.             0,                 
  92.             0                
  93.         },    
  94.         
  95.         0x0,                // • version number 
  96.                             // ( not used with 'useSrcCrDateToCompare' )
  97.                             
  98.         0,                    // 'invc' code resource - not used
  99.         0,                    // 'inex' code resource - not used
  100.         ""                    
  101.     }
  102. };
  103.  
  104. // simple version compare ( 'vers' (1) ) file atom
  105. resource 'infa' (2000) {
  106.     format1 {
  107.         deleteWhenRemoving,                
  108.         deleteWhenInstalling,            
  109.         copy,                            
  110.  
  111.         dontIgnoreLockedFile,            
  112.         dontSetFileLocked,                
  113.  
  114.         useVersProcToCompare,    // • use version resource for comparison
  115.                                 // - defaults to std version compare
  116.                                 // if no 'invc' code resource specifed below
  117.                                         
  118.         srcNeedNotExist,                
  119.         rsrcForkInRsrcFork,
  120.         leaveAloneIfNewer,        //  • if target file is newer:
  121.                                 //  Easy Install - skip installing file
  122.                                 //    Custom Install - ask "newer,older,cancel"
  123.  
  124.         updateExisting,                    
  125.         copyIfNewOrUpdate,                
  126.         
  127.         rsrcFork,
  128.         dataFork,
  129.  
  130.         0,                    // TARGET - size ( 0 filled in by ScriptCheck )
  131.         0x0,                // Finder Attribute flags ( 0x0 filled in by ScriptCheck )
  132.         20000,                // TARGET - file spec ( 'infs' )
  133.         {    
  134.             20000,            // SOURCE - file spec ( 'infs' )
  135.             0,                 
  136.             0                
  137.         },    
  138.         
  139.         0x0,                // • version number for comparisons
  140.                             // NOTE: this value is filled in by ScriptCheck
  141.                             // when value is set to 0x0 and
  142.                             // 'useVersProcToCompare' flag is specified
  143.                             
  144.         0,                    // 'invc' code resource - none used
  145.                             // • be sure this is set to zero to force
  146.                             // the Installer to use its default
  147.                             // version comparison method
  148.         
  149.         0,                    // 'inex' code resource - none used
  150.         ""                    // file atom description
  151.     }
  152. };
  153.  
  154.  
  155. // • creation date comparison file specs
  156.  
  157. // target file spec
  158. resource 'intf' (10000) {
  159.     format1 {
  160.         noSearchForFile,             // use default search path
  161.         TypeCrNeedNotMatch,         // target TYPE,CREATOR need not match
  162.         'APPL',                     // target TYPE ( ignored, see above )
  163.         'ttxt',                     // target CREATOR ( ignored, see above )
  164.         0,                             // finder attribute flags
  165.         
  166.         0x1,                          // creation date for new file or to compare
  167.                                     // with creation date of existing file.
  168.                                             
  169.         0x1,                          // modification date for new file
  170.                                     // ( filled by ScriptCheck if set to 1 )
  171.                                     // - this is only used when creating
  172.                                     // a new file, they are not used for
  173.                                     // comparisons.
  174.         
  175.         0,                             // search proc ID ( 'insp' )
  176.         
  177.         ":Simple Compare Example:TeachText • comp by date"    
  178.                                     // path to target file
  179.         }
  180.     };
  181.  
  182. // source file spec
  183. resource 'infs' (10000) {
  184.     'APPL',                
  185.     'ttxt',                
  186.     0x1,
  187.     noSearchForFile,
  188.     TypeCrMustMatch,
  189.     "Disk 1:TeachText • comp by date"
  190. };
  191.  
  192.  
  193.  
  194. // • version comparison file specs
  195.  
  196. // target file spec
  197. resource 'intf' (20000) {
  198.     format1 {
  199.         noSearchForFile,                     
  200.         TypeCrNeedNotMatch,                 
  201.         'APPL',                             
  202.         'ttxt',                             
  203.         0,                                         
  204.         0x1,                          // creation date for new file                                            
  205.         0x1,                          // modification date for new file
  206.                                     // ( value of 1 filled by ScriptCheck )
  207.                                     // - these are only used when creating
  208.                                     // a new file
  209.         0,    
  210.         ":Simple Compare Example:TeachText • comp by vers"    
  211.                                     // path to target file
  212.         }
  213.     };
  214.  
  215. // source file spec
  216. resource 'infs' (20000) {
  217.     'APPL',                
  218.     'ttxt',                
  219.     0x1,
  220.     noSearchForFile,
  221.     TypeCrMustMatch,
  222.     "Disk 1:TeachText • comp by vers"
  223. };
  224.  
  225.